package java115.Thread;
//多线程同时输出
public class Thread30 {
public static void main(String[] args) throws InterruptedException {
    Thread[] threads = new Thread[30];
    for (int i = 0; i < threads.length; i++) {
        final int n = i;
        threads[i] = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println(n);
            }
        });
    }
    for(Thread t : threads) {
        t.start();
    }
    for(Thread t : threads) {
        t.join();
    }
    System.out.println("OK");
}
}
